<?php
namespace app\serverintegralmall\validate;
use \app\manage\validate\BaseValidate;

class GoodsCategory extends BaseValidate
{
    //添加和编辑的时候的验证规则
	protected $rule =   [
        'app_id'  => ['integer','gt'=>0],
        'is_public' => ['in'=>'0,1'],
        'name'  => ['length'=>'2,25'],
        'id'    => ['integer','gt'=>0],
        'limit'    => ['integer','egt'=>0],
    	'pid'   => ['integer','egt'=>0],
    	'order' => ['integer','egt'=>0],
    	'status'=> ['in'=>'0,1'],
    ];

    protected $message  =   [
        'name'     => '名称在2-25个字符之间',
        'pid.integer'   => '上级分类错误',
        'order.integer' => '排序为整数',
        'status'       => '状态错误',
    ];

    protected $scene = [
        'edit' => ['app_id'=>['require','integer','gt'=>0],'is_public','name','id'=>['require','integer','gt'=>0],'order'],
        'oneCateInfo' => ['id' => ['require','integer','gt'=>0],'app_id'],
        'changeCateStatus' => [
            'status' => ['require','in'=>'0,1'],
            'id'     => ['require','array','min'=>1],
            'app_id'
        ],
        'delCate' => [
            'id'  => ['require','array','min'=>1],'app_id'
        ],
        'goodsCateList' => [
            'id'  => ['require','integer','egt'=>0],'app_id','recommend'
        ]
    ];

}